package com.aizuda.boot.modules.common.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 任务类型枚举
 */
@Getter
@AllArgsConstructor
public enum TaskTypeEnum {

    PENDING("PENDING", "我的待办"),
    COMPLETED("COMPLETED", "我的已办"),
    CC("CC", "抄送我的");

    private final String code;
    private final String description;

    /**
     * 根据代码获取枚举
     */
    public static TaskTypeEnum fromCode(String code) {
        for (TaskTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown task type: " + code);
    }
}
